# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=cachefilesd
pkgver=0.10.10
pkgrel=3
pkgdesc="Userspace daemon acting as a backend for FS-Cache"
url="https://people.redhat.com/~dhowells/fscache/"
arch="all"
license="GPL"
depends="attr"
makedepends="rpm file"
options="!check"
subpackages="$pkgname-doc"
source="https://people.redhat.com/~dhowells/cachefs/$pkgname-$pkgver.tar
	$pkgname.initd
	musl-stat64.patch
"

build() {
	sed -i "s#/sbin/#/usr/bin/#g" cachefilesd.c
	sed -i "s#/sbin/#/usr/bin/#g" cachefilesd.service
	make CFLAGS="$CFLAGS"
}

package() {
	make DESTDIR="$pkgdir" SBINDIR=/usr/bin install
	mkdir -p "$pkgdir"/var/cache/fscache
	install -D -m 755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
}

sha512sums="
d7d816b5ef1fffe1272cb8c2e9cbd18c1393438afca250436a36a446c6a37303e7784057725a56be839e0489101190b563c4fc015fc4ff11baa8003121e5183a  cachefilesd-0.10.10.tar
854b66470ace24caf24e979de3c1c12a426972bc745823b3a0f47ac80811ac5da4fa6a249e65386acdec2e7561178bb1d2c4b301a2178458f10496bb8eac5b2f  cachefilesd.initd
e4611595320bb4d6168d2b5a5b3d711251041c25cf8d6e1a4e58122a732ee971fe34d5968dedaa36f6d1e1951af218c931b133da5d208eef0e325334bd63e627  musl-stat64.patch
"
